package basic.socket.chat;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.Socket;

/**
 * @author bingo
 * @Description      聊天室客户端存在的问题：发送与接收不能够同时运行
 * @Date 2018/7/20
 */
public class Client {

    public static void main(String[] args) {
        try {
           // Socket client = new Socket("192.168.5.102",8888);
            Socket client = new Socket("127.0.0.1",8888);

            BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in));


            System.out.println("请输入昵称:");
            String name  = bufferedReader.readLine();

            Thread send = new Thread(new Send(client,name));

            Thread receive = new Thread(new Receive(client));

            send.start();
            receive.start();

        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
